import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'package:nmb/services/database.dart';
import 'package:nmb/services/global.dart';
import 'package:timeago/timeago.dart' as timeago;

import 'screens/note_list.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  Get.put<DatabaseService>(DatabaseService(),permanent: true);
  await Get.find<DatabaseService>().database;
  Get.put<GlobalService>(GlobalService(), permanent: true);
  timeago.setLocaleMessages('zh_CN', timeago.ZhCnMessages());
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.amber,
        visualDensity: VisualDensity.adaptivePlatformDensity,
        scaffoldBackgroundColor: Colors.black
      ),
      debugShowCheckedModeBanner: false,
      home: const NotesListScreen(),
    );
  }
}